<?php
/**
 * Author: DefinitlyEvil
 * Created at: 2020/4/14 19:19
 */

namespace App;


use App\Tools\DBHelper;
use App\Tools\RedisHelper;

class Controller
{
    private $pdo = null;
    private $redis = null;

    public $needAuth = true;
    public $user = null;

    /**
     * @return \PDO
     */
    public function getPdo()
    {
        if($this->pdo === null) {
            $this->pdo = DBHelper::connect();
        }
        return $this->pdo;
    }

    /**
     * @return \Redis
     */
    public function getRedis()
    {
        if($this->redis === null) {
            $this->redis = RedisHelper::connect();
        }
        return $this->redis;
    }
}